package main

import (
	"context"
	"fmt"
	"github.com/PedroGao/go-advanced-tutorial/rpc/person"
	"google.golang.org/grpc"
)

func main() {
	// 未开器 HTTPS 连接，方便本地测试，生产环境切记不要！！！
	conn, err := grpc.Dial(":3000", grpc.WithInsecure())
	if err != nil {
		panic(err)
	}
	defer conn.Close()

	c := person.NewGreeterClient(conn)

	r, err := c.SayHello(context.Background(), &person.HelloRequest{
		Name: "pedro",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(r.Message)
}
